package com.magicalcoder.youyamvc.app.goodsspec.dao.impl;

import com.magicalcoder.youyamvc.app.goodsspec.dao.GoodsSpecDao;
import com.magicalcoder.youyamvc.app.model.GoodsSpec;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* 代码为自动生成 Created by www.magicalcoder.com
* 如果你改变了此类 read 请将此行删除
*  欢迎加入官方QQ群:323237052
*/

@Component("goodsSpecDao")
public class GoodsSpecDaoImpl   implements GoodsSpecDao {

    @Resource(name="sqlSessionTemplate")
    private  SqlSessionTemplate  sqlSessionTemplate;
    @Override
    public GoodsSpec getGoodsSpec(Map<String, Object> query) {
        return sqlSessionTemplate.selectOne("GoodsSpecMapper.getGoodsSpec",query);
    }
    @Override
    public List<GoodsSpec> getGoodsSpecList(Map<String, Object> query) {
        return sqlSessionTemplate.selectList("GoodsSpecMapper.getGoodsSpecList", query);
    }
    @Override
    public Integer getGoodsSpecListCount(Map<String, Object> query) {
        return sqlSessionTemplate.selectOne("GoodsSpecMapper.getGoodsSpecListCount", query);
    }

    @Override
    public void batchInsertGoodsSpec(List<GoodsSpec> list) {
        sqlSessionTemplate.insert("GoodsSpecMapper.batchInsertGoodsSpec",list);
    }

    @Override
    public void batchUpdateGoodsSpec(List<GoodsSpec> list) {
        sqlSessionTemplate.update("GoodsSpecMapper.batchUpdateGoodsSpec",list);
    }

    @Override
    public     Long  insertGoodsSpec(GoodsSpec entity) {
        sqlSessionTemplate.insert("GoodsSpecMapper.insertGoodsSpec",entity);
  return entity.getId();    }
    @Override
    public void updateGoodsSpec(GoodsSpec entity) {
        sqlSessionTemplate.update("GoodsSpecMapper.updateGoodsSpec", entity);
    }
    @Override
    public void updateGoodsSpecWithoutNull(GoodsSpec entity) {
        sqlSessionTemplate.update("GoodsSpecMapper.updateGoodsSpecWithoutNull", entity);
    }
    @Override
    public void updateGoodsSpecByWhereSql(Map<String,Object> entity) {
        sqlSessionTemplate.update("GoodsSpecMapper.updateGoodsSpecByWhereSql", entity);
    }

    @Override
    public List<GoodsSpec> getGoodsSpecOneToOneRelateList(Map<String, Object> query){
        return sqlSessionTemplate.selectList("GoodsSpecMapper.getGoodsSpecOneToOneRelateList", query);
    }
    @Override
    public Integer getGoodsSpecOneToOneRelateListCount(Map<String, Object> query){
        return sqlSessionTemplate.selectOne("GoodsSpecMapper.getGoodsSpecOneToOneRelateListCount", query);
    }
    @Override
    public void truncateGoodsSpec() {
        sqlSessionTemplate.delete("GoodsSpecMapper.truncateGoodsSpec");
    }
    @Override
    public void deleteGoodsSpec(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsSpecMapper.deleteGoodsSpec",query);
    }
    @Override
    public void deleteGoodsSpecList(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsSpecMapper.deleteGoodsSpecList",query);
    }
    @Override
    public void deleteGoodsSpecByWhereSql(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsSpecMapper.deleteGoodsSpecByWhereSql",query);
    }
    @Override
    public void batchDeleteGoodsSpec(List<Long> list) {
        sqlSessionTemplate.delete("GoodsSpecMapper.batchDeleteGoodsSpec",list);
    }
    @Override
    public void batchDeleteGoodsSpecList(List<GoodsSpec> list) {
        sqlSessionTemplate.delete("GoodsSpecMapper.batchDeleteGoodsSpecList",list);
    }

}
